package cn.ubeta.b2c;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.annotation.Nullable;

import cn.ubeta.b2c.common.AnalyseActivity;

/**
 * Created by denny on 16/8/17.
 */
public class SplashActivity extends AnalyseActivity implements Handler.Callback {

    @Nullable
    private Handler mHandler;

    @Override
    public String getPageName() {
        return "启动页";
    }

    @Override
    protected boolean needPermissionCheck() {
        return false;
    }

    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        mHandler = new Handler(Looper.getMainLooper(), this);
        mHandler.sendEmptyMessageDelayed(0, 500);
    }

    @Override
    public void onBackPressed() {
        // 启动页返回键不能退出
    }

    @Override
    public boolean handleMessage(Message message) {
        // 启动主页面
        HomeActivity.gotoHome(this);
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        finish();
        mHandler = null;
        return false;
    }
}
